import requests
import re
from lxml import etree
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
                         "(KHTML, like Gecko) Chrome/75.0.3760.0 Safari/537.36 Edg/75.0.126.0"}


def ls():
    for x in range(1, 3):
        url=f'http://www.pinsuodesign.com/design/d-1-{x}.html'
    #print(url)
        html=requests.get(url).text
    #print(html)
        nr=etree.HTML(html)
    #print(nr)
        a=nr.xpath('/html/body/div[5]/div/div/div[2]/div/div[1]/div/div[1]/a')
        print(a)
        href = []
        for link in a:
            print(link.attrib['href'])
            href.append(link.attrib['href'])
            print(href)
            #return href

ls()
print(href)

#/html/body/div[5]/div/div/div[2]/div[3]/div[1]/div/div[1]/a
#/html/body/div[5]/div/div/div[2]/div[7]/div[1]/div/div[1]/a
#print(y.attrib['href'])
#/html/body/div[5]/div/div/div[2]/div[2]/div[1]/div/div[1]/a
#/html/body/div[5]/div/div/div[2]/div[3]/div[1]/div/div[1]/a

#/html/body/div[6]/div/div/div/a[2]
#zelink=r'''<div class="news-title">
                                        #<a href="(.+?)">'''
#link=re.findall(zelink,html,re.S)
#print(link)
#for L in link:
    #print('http://www.pinsuodesign.com'+L)


